package com.handpay.zztong.hp.login.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

import com.handpay.zztong.hp.base.activity.ZZTongActivity;
import com.handpay.zztong.hp.config.ZZTConstant;
import com.handpay.zztong.hp.main.activity.MainActivity;
import com.handpay.zztong.hp.R;
import com.handpay.zztong.hp.bean.ActionBar;

public class RegisterResultActivity extends ZZTongActivity implements OnClickListener {
    private TextView accountTextView;
    private TextView phoneTextView;
    private Button registerSubmitButton;
    private Button registerSubmitLaterButton;
    private String account;
    private String phone;
    public static final String FROM_REG_RESULT = "from_reg_result";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        this.setContentView(R.layout.activity_register_result);
        super.onCreate(savedInstanceState);
        this.account = getIntent().getStringExtra("account");
        this.phone = getIntent().getStringExtra("phone");
        this.accountTextView = (TextView) findViewById(R.id.register_result_account);
        accountTextView.setText(account);
        this.phoneTextView = (TextView) findViewById(R.id.register_result_phone);
        phoneTextView.setText(phone);
        this.registerSubmitButton = (Button) findViewById(R.id.registerSubmitButton);
        this.registerSubmitButton.setOnClickListener(this);
        this.registerSubmitLaterButton = (Button) findViewById(R.id.registerSubmitLaterButton);
        this.registerSubmitLaterButton.setOnClickListener(this);
    }

    @Override
    public ActionBar getActivityActionBar() {
        return new ActionBar(this.getString(R.string.register_result_title));
    }

    @Override
    public void onClick(View v) {
        int i = v.getId();

        if (i == R.id.registerSubmitButton) {
            goToMainActivity();
        } else if (i == R.id.registerSubmitLaterButton) {
            onFunctionTab(null);
        }
    }


    @Override
    protected boolean isShownTabs() {
        return false;
    }

    @Override
    public void goToVPos() {
        super.goToVPos();
        goToMainActivity();
    }

    public void goToMainActivity() {
        if (checkSwiperOk(this, true)) {
            Intent intent = new Intent(this, MainActivity.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            intent.putExtra(FRAGMENTFLAG, ZZTConstant.FRAGMENT_FLAG_MY);
            intent.putExtra("isComposeIntent", true);
            this.startActivity(intent);
        }
    }
}
